<script lang="ts">
    import GraphqlForm from "$lib/GraphqlForm.svelte";

    import SRM from "$lib/js/srm";

    const DAY_IN_MINISECONDS = 24 * 60 * 60 * 1000;

    const today = Math.round(new Date().getTime() / DAY_IN_MINISECONDS);

    const yesterday = today - 1;
    const todayp1 = today + 1;
    const todayp2 = today + 2;
    const todayp3 = today + 3;

    const todayp4 = today + 4;

    const ms = new SRM([1, 2, 3, 8, 17], [-3, -1, 1]);

    const record = ms.getInitialRecord(yesterday);
    const updatedRecord1 = ms.calculate(2, record, today);
    const updatedRecord2 = ms.calculate(2, updatedRecord1, todayp1);
    const updatedRecord3 = ms.calculate(2, updatedRecord2, todayp2);
    const updatedRecord4 = ms.calculate(2, updatedRecord3, todayp3);

    console.log("updatedRecord1 = ", updatedRecord1);
    console.log("updatedRecord2 = ", updatedRecord2);
    console.log("updatedRecord3 = ", updatedRecord3);
    console.log("updatedRecord4 = ", updatedRecord4);
</script>

<h1>GraphqlForm.svelte</h1>

<GraphqlForm />
